<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
	<title>Dom编程实例--留言板</title>
	<script type="text/javascript">
	//创建标签对象
		function addMsg()
		{
			var tb=document.getElementById("tb");
			tb.border="3";
			var tbo=(tb.tBodies)[0];
			var name=document.getElementById("name").value;
			var content=document.getElementById("content").value;
			var date=new Date();
			//alert(name+":"+content);
			//创建tr
			var tr=document.createElement("tr");
			var td1=document.createElement("td");
			td1.innerHTML=name;
			var td2=document.createElement("td");
			td2.innerHTML=content;
			var td3=document.createElement("td");
			td3.innerHTML=date.toLocaleDateString()+" "+date.toLocaleTimeString();
			tr.appendChild(td1);
			tr.appendChild(td2);
			tr.appendChild(td3);
			tbo.appendChild(tr);

		}
	</script>
</head>
<body>
	1、留言版
	发布人:<input type="text" id="name" />
	内容：<textarea  id="content" cols="30" rows="10"></textarea>
	<input type="button" onclick="addMsg()" value="发布" />
	<table id="tb">
		<thead>
			<tr>
				<th>发布人</th>
				<th>发布内容</th>
				<th>发布时间</th>
			</tr>
		</thead>
		<tbody>
			
		</tbody>
	</table>
</body>
</html>